import { defHttp } from '/@/utils/http/axios';
import {
  DeleteModel,
  ServiceModel,
  eqtClassModel,
  ServicePageParams,
  ServicePageListGetResultModel,
} from '/@/extendModel/brandModel';
enum Api {
  ADD_UPDATE_DELETE_SERVICE = '/brand/brand',
  GET_SERVICE_LIST = '/brand/brands',

  addeqtClassApi = '/device/category/create_gateway_device_category',
  editeqtClassApi = '/device/category/update_gateway_device_category',
  deleqtClassApi = '/device/category/delete_gateway_device_category',
  geteqtClassByPage = '/device/category/query_gateway_device_category_all',
  alleqtClass = '/device/category/query_gateway_device_category_all',
}
//添加
export const addBrandApi = (data: ServiceModel) =>
  defHttp.post({ url: Api.ADD_UPDATE_DELETE_SERVICE, data });
//修改
export const editBrandApi = (data: ServiceModel, params) =>
  defHttp.patch<ServiceModel[]>({ url: Api.ADD_UPDATE_DELETE_SERVICE, data, params });
//删除
export const deleteBrandApi = (data: DeleteModel) =>
  defHttp.delete<DeleteModel[]>({ url: Api.ADD_UPDATE_DELETE_SERVICE, data });
//列表
export const getBrandListByPage = (params?: ServicePageParams) =>
  defHttp.get<ServicePageListGetResultModel>({ url: Api.GET_SERVICE_LIST, params });

//添加
export const addeqtClassApi = (data: eqtClassModel) =>
  defHttp.post({ url: Api.addeqtClassApi, data });
//修改
export const editeqtClassApi = (data: eqtClassModel, params) =>
  defHttp.put<eqtClassModel[]>({ url: Api.editeqtClassApi, data, params });
//删除
export const deleqtClassApi = (data: DeleteModel) =>
  defHttp.delete<DeleteModel[]>({ url: Api.deleqtClassApi, data });
//列表
export const geteqtClassByPage = (params?: ServicePageParams) =>
  defHttp.get<ServicePageListGetResultModel>({ url: Api.geteqtClassByPage, params });

//获取所有设备分类
export const alleqtClass = (params?: ServicePageParams) =>
  defHttp.get<ServicePageListGetResultModel>({ url: Api.alleqtClass, params });
